package com.cloudbroker.bcs.common.mq.rabbitmq.basic;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;

@Component
public class Publisher {
    
    private static final Logger LOGGER = LoggerFactory.getLogger(Publisher.class);

    @Resource
    private AmqpTemplate amqpTemplate;

    public void send(String exchange, String routingKey, Object message) {
        amqpTemplate.convertAndSend(exchange, routingKey, message);
        LOGGER.info("sent message: " + exchange + " | " + routingKey + " | " + message);
    }

}
